package com.xxxy.df.baseui;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;

public class MainActivity extends AppCompatActivity {
    Button btnRegiste;
    Button btnCycle;
    Button btnTranse;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        EdgeToEdge.enable(this);
        setContentView(R.layout.activity_main);
        ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
            Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
            v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
            return insets;
        });
        init(); // 初始化界面组件
    }

    protected void init(){
        // 注册按钮及其点击事件
        btnRegiste = findViewById(R.id.btn_register);
        btnRegiste.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(MainActivity.this,StudentRegisteActivity.class);
                startActivity(intent); // 跳转到学生注册页面
            }
        });

        // 生命周期演示按钮及其点击事件
        btnCycle = findViewById(R.id.btn_cyclelife);
        btnCycle.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(MainActivity.this,CycleLifeActivity.class);
                startActivity(intent); // 跳转到生命周期演示页面
            }
        });

        // 答题功能按钮及其点击事件
        btnTranse = findViewById(R.id.btn_transe);
        btnTranse.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(MainActivity.this,A1Activity.class);
                startActivity(intent); // 跳转到答题页面
            }
        });
    }
}
